/*
 * @Author       : lptecodad lptecodad@sina.com
 * @Date         : 2023-03-20 09:56:03
 * @LastEditors  : lptecodad lptecodad@sina.com
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
 */
import service from '/@/utils/request';

/**
 * （不建议写成 service.post(xxx)，因为这样 post 时，无法 params 与 data 同时传参）
 *
 */
export const usePersonTemplateQueryApi = (code: string,) => {
    return service({
        url: `v0/person/template/query`,
        method: 'GET',
        params: { code: code },
    });
}
export const usePersonTemplatePageApi = (formData?: object) => {
    return service({
        url: `v0/person/template/page`,
        method: 'POST',
        data: formData
    });
}

export const usePersonTemplateCreateApi = (formData: object) => {
    return service({
        url: `v0/person/template/create`,
        method: 'POST',
        data: formData
    });
}
export const usePersonTemplateUpdateApi = (formData: object) => {
    return service({
        url: `v0/person/template/update`,
        method: 'PUT',
        data: formData
    });
}

export const usePersonTemplateDeleteApi = (param: string | string[]) => {
    let arrList: string[] = []

    if (param instanceof Array) {
        arrList = param
    } else {
        arrList.push(param)
    }

    return service({
        url: `v0/person/template/delete`,
        method: 'DELETE',
        data: { codeList: arrList }
    });
}

export const usePersonTemplateListApi = () => {
    return service({
        url: `v0/person/template/list`,
        method: 'GET'
    });
}

